<template>
	<view>
		<form @submit="savepubinfo" report-submit>
			<view class="container" v-if="showdata">
				<view class="main">
					<view class="header"></view>
					<view class="title">个人基本信息</view>
					<view class="list">
						<view class="item">
							<view class="name">
								隐藏
								<text>*</text>
							</view>
							<view class="selectitem">
								<radio-group class="radio-group" @change="radioHiddenChange">
									<label class="radio">
										<radio value="1" :checked="noteinfo.ishidden == 1 ? 'checked' : ''" />
										是
									</label>
									<label class="radio">
										<radio value="0" :checked="noteinfo.ishidden == 0 ? 'checked' : ''" />
										否
									</label>
								</radio-group>
							</view>
						</view>

						<view class="item">
							<view class="name">
								姓 名
								<text>*</text>
							</view>
							<view class="selectitem">
								<input :value="noteinfo.name ? noteinfo.name : ''" type="text" name="name"
									placeholder="请输入姓名" cursor-spacing="140" />
							</view>
						</view>

						<view class="item">
							<view class="name">
								出生年份
								<text>*</text>
							</view>
							<view class="selectitem">
								<picker :value="Index" :range="birthday" @change="bindBirthdayChange">
									<view class="picker">
										{{ birthday[birthdayindex] ? birthday[birthdayindex] : '请选择出生年份' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">
							<view class="name">
								性 别
								<text>*</text>
							</view>
							<view class="selectitem">
								<radio-group class="radio-group" @change="radioChange">
									<label class="radio">
										<radio value="1" :checked="noteinfo.gender == 1 ? 'checked' : ''" />
										男
									</label>
									<label class="radio">
										<radio value="0" :checked="noteinfo.gender == 0 ? 'checked' : ''" />
										女
									</label>
								</radio-group>
							</view>
						</view>

						<!-- <view class="item">
							<view class="name">
								身份证号
								<text>*</text>
							</view>
							<view class="selectitem">
								<input :value="noteinfo.cardnum ? noteinfo.cardnum : ''" type="text" name="cardnum"
									placeholder="请输入身份证号" cursor-spacing="140" />
							</view>
						</view> -->

						<view class="item">
							<view class="name">
								手机号码
								<text>*</text>
							</view>
							<view class="selectitem">
								<input type="text" :value="noteinfo.tel ? noteinfo.tel : ''" name="tel"
									placeholder="请输入手机号码" cursor-spacing="140" />
							</view>
						</view>

						<view class="item">
							<view class="name">
								最高学历
								<text>*</text>
							</view>
							<view class="selectitem">
								<picker :value="Index" :range="education" range-key="" @change="bindEducationChange">
									<view class="picker">
										{{ education[educationindex] ? education[educationindex] : '请选择学历要求' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">
							<view class="name">
								工作经验
								<text>*</text>
							</view>
							<view class="selectitem">
								<picker :value="Index" :range="express" @change="bindExpressChange">
									<view class="picker">
										{{ express[expressindex] ? express[expressindex] : '请输入工作经验' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">

							<view class="name">想找的行业</view>
							<view class="selectitem">
								<picker :value="Index" :range="jobcate" range-key="name" @change="bindJobcateChange">
									<view class="picker">
										{{ jobcateindex >= 0 ? jobcate[jobcateindex].name : '请选择想找的行业' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">
							<view class="name">
								想找的职位
								<text>*</text>
							</view>
							<view class="selectitem">
								<input :value="noteinfo.jobtitle ? noteinfo.jobtitle : ''" type="text" name="jobtitle"
									placeholder="请输入想找的职位" cursor-spacing="140" />
							</view>
						</view>

						<view class="item">
							<view class="name">工作性质</view>
							<view class="selectitem">
								<picker :value="Index" :range="worktypelist" range-key="name"
									@change="bindWorktypeChange">
									<view class="picker">
										{{ worktypeindexid >= 0 ? worktypelist[worktypeindexid].name : '请选择工作性质' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">
							<view class="name">期望薪资</view>
							<view class="selectitem">
								<picker :value="Index" :range="jobprice" range-key="name" @change="bindJobpriceChange">
									<view class="picker">
										{{ jobpriceindex >= 0 ? jobprice[jobpriceindex].name : '请选择薪资待遇' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">
							<view class="name">
								现居住地
								<text>*</text>
							</view>
							<view class="selectitem">
								<input type="text" :value="noteinfo.address ? noteinfo.address : ''" name="address"
									placeholder="请输入现居住地" cursor-spacing="140" />
							</view>
						</view>
					</view>
				</view>

				<view class="main">
					<view class="title">
						个人详情信息
						<text>*</text>
					</view>
					<view class="list">
						<view class="item">
							<view class="name">目前状态</view>
							<view class="selectitem">
								<picker :value="Index" :range="currentstatus" @change="bindCurrentChange"
									range-key="name">
									<view class="picker">
										{{ currentstatusindex >= 0 ? currentstatus[currentstatusindex].name : '请选择目前状态' }}
									</view>
								</picker>
							</view>
						</view>

						<view class="item">
							<view class="name">工作地区</view>
							<view class="selectitem">
								<picker :value="Index" :range="arealist" range-key="name" @change="bindAreaChange">
									<view class="picker">
										{{ areaindexid >= 0 ? arealist[areaindexid].name : '请选择工作地区' }}
									</view>
								</picker>
							</view>
						</view>
					</view>
				</view>

				<view class="uploadlist">
					<view class="title">
						<view>头像</view>
						<view>(禁止上传不良图片)</view>
					</view>
					<view class="item">
						<view class="uploadimg" @tap="chooseImg" data-id="1">
							<image src="/static/imgs/icon/upload.png"></image>
							<view class="uploadtitle">上传头像最多1张</view>
						</view>
					</view>
				</view>

				<view class="uploadlist" :style="'display:' + show1 + ';'">
					<view class="imgsbox">
						<view class="weui-uploader">
							<view class="img-v">
								<view class="img" v-for="(item, index) in imgs1" :key="index">
									<image :src="item" :data-index="index" mode="aspectFill" @tap="previewImg1"></image>

									<view class="delete-btn" :data-index="index" @tap.stop.prevent="deleteImg1">
										<image class="imgx" src="/static/imgs/icon/x.png"
											style="width: 15rpx; height: 15rpx"></image>
										删除
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

				<!--

<view class="main">
        <view class="title">
          个人介绍
        </view>
        <view class="list">
            <view class="item">
        
         <view class="selectitem" style='width:100%;height: 500rpx;line-height: 500rpx;'>

         
          <editor id="editor" class="ql-container" placeholder="{{placeholder}}" bindstatuschange="onStatusChange" bindready="onEditorReady">
  </editor>


         
         </view>

            </view>
          
            
        </view>


    </view>


-->
			</view>

			<view class="weixinmao-float">
				<view class="weixinmao-foot">
					<button class="footer" formType="submit"
						style="bottom: 10px; background-color: #fe552e">下一步</button>
				</view>
			</view>
		</form>
	</view>
</template>

<script>
	import {
		Note
	} from '../findworker/note-model.js';
	var note = new Note();
	export default {
		data() {
			return {
				/*
				  formats: {},
				  readOnly: false,
				  placeholder: '开始输入...',
				  editorHeight: 300,
				  keyboardHeight: 0,
				  isIOS: false,
				  */
				speciallist: [{
						name: '五险一金',
						checked: false
					},
					{
						name: '补充医疗保险',
						checked: false
					},
					{
						name: '员工旅游',
						checked: false
					},
					{
						name: '交通补贴',
						checked: false
					},
					{
						name: '餐饮补贴',
						checked: false
					},
					{
						name: '出国机会',
						checked: false
					},
					{
						name: '年终奖金',
						checked: false
					},
					{
						name: '定期体检',
						checked: false
					}
				],

				birthday: [
					'1960',
					'1961',
					'1962',
					'1963',
					'1964',
					'1965',
					'1966',
					'1967',
					'1968',
					'1969',
					'1970',
					'1971',
					'1972',
					'1973',
					'1974',
					'1975',
					'1976',
					'1977',
					'1978',
					'1979',
					'1980',
					'1981',
					'1982',
					'1983',
					'1984',
					'1985',
					'1986',
					'1987',
					'1988',
					'1989',
					'1990',
					'1991',
					'1992',
					'1993',
					'1994',
					'1995',
					'1996',
					'1997',
					'1998',
					'1999',
					'2000',
					'2001',
					'2002',
					'2003',
					'2004'
				],
				birthdayindex: -1,
				birthdayname: '',
				education: ['初中以下', '初中', '高中', '中技', '中专', '大专', '本科', '硕士', '博士', '博后'],
				educationindex: -1,
				educationname: '',
				express: ['无经验', '1年以下', '1-3年', '3-5年', '5-10年', '10年以上'],
				expressindex: -1,
				expressname: '',
				currentstatus: [],
				currentstatusindex: -1,
				currentid: '',
				worktype: ['全职', '兼职', '实习'],
				worktypeindex: -1,
				worktypename: '',
				money: ['1千~2千/月', '2千~3千/月', '3千~4千/月', '4千~5千/月', '5千~1万/月', '1万以上/月'],
				moneyindex: -1,
				moneyname: '',
				arealist: [],
				areaindexid: -1,
				areaid: 0,
				imgurl1: false,
				true1: true,
				show1: 'none',
				logoimglist: [],
				imgs1: [],
				worktypelist: [],
				worktypeindexid: -1,
				worktypeid: 0,
				ishidden: 1,
				jobprice: '',
				jobpriceindex: -1,
				jobcateindex: -1,

				noteinfo: {
					ishidden: 0,
					name: false,
					gender: 0,
					cardnum: false,
					tel: false,
					jobtitle: false,
					address: false
				},

				jobcate: '',
				editorHeight: '',
				keyboardHeight: '',
				formats: '',
				imgs2: '',
				show2: '',
				Index: 0,
				name: false,
				showdata: false
			};
		}
		/**
		 * 生命周期函数--监听页面加载
		 */
		,
		onLoad: function(options) {
			uni.setNavigationBarTitle({
				title: '我的简历'
			});
			var that = this;

			/*
      const platform = wx.getSystemInfoSync().platform;
      const isIOS = platform === 'ios';
      this.setData({ isIOS });
      this.updatePosition(0);
      let keyboardHeight = 0;
  
      wx.onKeyboardHeightChange(res => {
        if (res.height === keyboardHeight) return
        const duration = res.height > 0 ? res.duration * 1000 : 0
        keyboardHeight = res.height
        setTimeout(() => {
          wx.pageScrollTo({
            scrollTop: 0,
            success() {
              that.updatePosition(keyboardHeight)
              that.editorCtx.scrollIntoView()
            }
          })
        }, duration)
  
      });
  */

			var cityinfo = uni.getStorageSync('cityinfo');
			console.log('城市内容', cityinfo)
			if (cityinfo) {
				uni.setStorageSync('city', cityinfo.name);
				that.initpage();
			} else {
				//获取信息
				qqmapsdk = new QQMapWX({
					key: '5D3BZ-J55WF-SFPJJ-NI6PG-YN2ZO-M4BHX' // 必填
				});

				uni.getLocation({
					type: 'gcj02',
					// 默认为 wgs84 返回 gps 坐标，gcj02 返回可用于 wx.openLocation 的坐标
					success: function(res) {
						uni.setStorageSync('latitude', res.latitude);
						uni.setStorageSync('longitude', res.longitude);
						qqmapsdk.reverseGeocoder({
							location: {
								latitude: res.latitude,
								longitude: res.longitude
							},
							success: function(addressRes) {
								var address = addressRes.result.address_component.city;
								var city = address.substr(0, address.length - 1);
								console.log(city);
								uni.setStorageSync('city', city);
								that.initpage();
							}
						});
					},
					fail: function() {
						// fail

						that.initpage();
					},
					complete: function() {
						// complete
					}
				});
			}
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {
			if(uni.getStorageSync('city') == '全国'){
				uni.redirectTo({
					url:'/pages/city/index?id=0'
				})
			}
		},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {},
		methods: {
			bindJobpriceChange: function(e) {
				var jobprice = this.jobprice;
				console.log(jobprice);
				if (jobprice) {
					this.jobpriceindex = e.detail.value;
					this.jobpriceid = jobprice[e.detail.value].id;
					this.money = jobprice[e.detail.value].name;
				}
				console.log(this.money);
				this.setData({
					jobprice: jobprice,
					jobpriceindex: e.detail.value
				});
			},

			initpage: function() {
				var that = this;
				var city;
				city = uni.getStorageSync('city');
				var params = {
					city: city
				};
				note.getPubNoteInit((data) => {
					console.log(data);
					that.arealist = data.arealist;
					that.worktypelist = data.worktypelist;
					that.currentstatus = data.currentlist;
					that.jobprice = data.jobpricelist;
					that.setData({
						jobprice: that.jobprice,
						worktypelist: that.worktypelist,
						currentstatus: that.currentstatus
					});
					var noteinfo = data.noteinfo;
					if (noteinfo) {
						console.log(data.worktypelist);
						that.worktypeindexid = isHasElementTwo(data.worktypelist, noteinfo.worktypeid);
						that.worktypeid = noteinfo.worktypeid;
						that.birthdayindex = isHasElementOne(that.birthday, noteinfo.birthday);
						that.birthdayname = noteinfo.birthday;
						that.jobcateindex = isHasElementTwo(data.jobcatelist, noteinfo.jobcateid);
						// console.log('index咋设置的啊',data.jobcatelist,noteinfo.jobcateid)
						that.jobcateid = noteinfo.jobcateid;
						that.jobpriceindex = isHasElementTwo(that.jobprice, noteinfo.jobpriceid);
						that.jobpriceid = data.jobpriceid;
						that.money = noteinfo.money;
						that.areaindexid = isHasElementTwo(data.arealist, noteinfo.areaid);
						that.areaid = noteinfo.areaid;
						that.educationindex = isHasElementOne(that.education, noteinfo.education);
						that.educationname = noteinfo.education;
						that.expressindex = isHasElementOne(that.express, noteinfo.express);
						that.expressname = noteinfo.express;
						that.areaindexid = isHasElementTwo(data.arealist, noteinfo.areaid);
						that.areaid = noteinfo.areaid;
						that.currentstatusindex = isHasElementTwo(data.currentlist, noteinfo.currentid);
						that.currentid = noteinfo.currentid;

						// that.data.moneyindex = isHasElementOne(that.data.money, noteinfo.money);
						// that.data.moneyname = noteinfo.money;

						that.worktypeindex = isHasElementOne(that.worktype, noteinfo.worktype);
						that.worktypename = noteinfo.worktype;

						//that.data.currentstatusindex = isHasElementOne(that.data.currentstatus, noteinfo.currentstatus);
						//that.data.currentstatusname = noteinfo.currentstatus;

						that.show1 = false;
						that.logoimglist.push(noteinfo.avatarUrl);
						that.imgs1.push(noteinfo.avatarUrl);
						console.log(noteinfo.avatarUrl);
						console.log(that.worktypeindexid);
						that.setData({
							birthdayindex: that.birthdayindex,
							jobcateindex: that.jobcateindex,
							educationindex: that.educationindex,
							expressindex: that.expressindex,
							moneyindex: that.moneyindex,
							currentstatusindex: that.currentstatusindex,
							areaindexid: that.areaindexid,
							worktypeindex: that.worktypeindex,
							noteinfo: data.noteinfo,
							show1: that.show1,
							imgs1: that.imgs1,
							jobpriceindex: that.jobpriceindex,
							worktypeindexid: that.worktypeindexid
						});
					}
					that.setData({
						jobcate: data.jobcatelist,
						worktypelist: data.worktypelist,
						arealist: that.arealist
					});
					that.showdata = true;
				}, params);
			},

			updatePosition(keyboardHeight) {
				const toolbarHeight = 50;
				const {
					windowHeight,
					platform
				} = uni.getSystemInfoSync();
				let editorHeight = keyboardHeight > 0 ? windowHeight - keyboardHeight - toolbarHeight : windowHeight;
				this.setData({
					editorHeight,
					keyboardHeight
				});
			},

			calNavigationBarAndStatusBar() {
				const systemInfo = uni.getSystemInfoSync();
				const {
					statusBarHeight,
					platform
				} = systemInfo;
				const isIOS = platform === 'ios';
				const navigationBarHeight = isIOS ? 44 : 48;
				return statusBarHeight + navigationBarHeight;
			},

			onEditorReady() {
				const that = this;
				console.log('fffffff');
				uni.createSelectorQuery()
					.in(uni)
					.select('#editor')
					.context(function(res) {
						that.editorCtx = res.context;
					})
					.exec();
			},

			blur() {
				this.editorCtx.blur();
			},

			format(e) {
				let {
					name,
					value
				} = e.target.dataset;
				if (!name) {
					return;
				}
				// console.log('format', name, value)
				this.editorCtx.format(name, value);
			},

			onStatusChange(e) {
				const formats = e.detail;
				console.log(formats);
				this.setData({
					formats
				});
			},

			insertDivider() {
				this.editorCtx.insertDivider({
					success: function() {
						console.log('insert divider success');
					}
				});
			},

			clear() {
				this.editorCtx.clear({
					success: function(res) {
						console.log('clear success');
					}
				});
			},

			removeFormat() {
				this.editorCtx.removeFormat();
			},

			insertDate() {
				const date = new Date();
				const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
				this.editorCtx.insertText({
					text: formatDate
				});
			},

			insertImage() {
				const that = this;
				uni.chooseImage({
					count: 1,
					success: function(res) {
						that.editorCtx.insertImage({
							src: res.tempFilePaths[0],
							data: {
								id: 'abcd',
								role: 'god'
							},
							width: '80%',
							success: function() {
								console.log('insert image success');
							}
						});
					}
				});
			},

			savepubinfo: function(e) {
				var that = this;
				/*
    that.editorCtx.getContents({
       success: (res) => {
         console.log(res.html);
         content = res.html;
       }})
    */

				var title = that.title;
				var userinfo = uni.getStorageSync('userInfo');
				var jobtitle = e.detail.value.jobtitle;
				var name = e.detail.value.name;
				var gender = that.gender;
				var ishidden = that.ishidden;
				// var cardnum = e.detail.value.cardnum;
				var birthday = this.birthdayname;
				var education = that.educationname;
				var express = that.expressname;
				var address = e.detail.value.address;
				var email = e.detail.value.email;
				var tel = e.detail.value.tel;
				var currentid = that.currentid;
				var worktype = that.worktypeid;
				var jobcateid = this.jobcateid;
				var money = this.money;
				var jobpriceid = this.jobpriceid;
				var areaid = this.areaid;
				var currentid = that.currentid;
				var tid = 0;
				var shareid = 0;
				var status = that.status;
				if (uni.getStorageSync('tid')) {
					tid = uni.getStorageSync('tid');
				}
				if (uni.getStorageSync('shareid')) {
					shareid = uni.getStorageSync('shareid');
				}
				if (name == '') {
					uni.showModal({
						title: '提示',
						content: '请输入姓名',
						showCancel: false
					});
					return;
				}
				if (birthday == '') {
					uni.showModal({
						title: '提示',
						content: '请选择出生年份',
						showCancel: false
					});
					return;
				}
				// if (cardnum == '') {
				// 	uni.showModal({
				// 		title: '提示',
				// 		content: '请输入身份证号',
				// 		showCancel: false
				// 	});
				// 	return;
				// } else {
				// 	let reg1 =
				// 		/^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; //正则表达式定义身份证号正确格式
				// 	if (!reg1.test(cardnum)) {
				// 		uni.showModal({
				// 			title: '提示',
				// 			content: '身份证号有误,请重新填写',
				// 			showCancel: false
				// 		});
				// 		return;
				// 	}
				// }
				if (tel == '') {
					uni.showModal({
						title: '提示',
						content: '请填写手机号',
						showCancel: false
					});
					return;
				} else {
					if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(tel)) {
						uni.showModal({
							title: '提示',
							content: '手机号有误,请重新填写',
							showCancel: false
						});
						return;
					}
				}
				if (education == '') {
					uni.showModal({
						title: '提示',
						content: '请选择最高学历',
						showCancel: false
					});
					return;
				}
				if (express == '') {
					uni.showModal({
						title: '提示',
						content: '请选择工作经验',
						showCancel: false
					});
					return;
				}
				if (jobcateid == 0) {
					uni.showModal({
						title: '提示',
						content: '请选择期望行业',
						showCancel: false
					});
					return;
				}
				if (jobtitle == '') {
					uni.showModal({
						title: '提示',
						content: '请输入意向职位',
						showCancel: false
					});
					return;
				}
				if (worktype == '') {
					uni.showModal({
						title: '提示',
						content: '请选择工作性质',
						showCancel: false
					});
					return;
				}
				if (money == '') {
					uni.showModal({
						title: '提示',
						content: '请选择期望薪资',
						showCancel: false
					});
					return;
				}
				if (currentid == 0) {
					uni.showModal({
						title: '提示',
						content: '请选择目前状态',
						showCancel: false
					});
					return;
				}
				/*
    
      if (content == "") {
       wx.showModal({
         title: '提示',
         content: '请输入个人介绍',
         showCancel: false
       })
       return
     }
    */

				var logoimglist = that.logoimglist;
				var cityinfo = uni.getStorageSync('cityinfo');
				var params = {
					cityid: cityinfo.id,
					areaid: areaid,
					jobtitle: jobtitle,
					name: name,
					gender: gender,
					ishidden: ishidden,
					tel: tel,
					address: address,
					// cardnum: cardnum,
					birthday: birthday,
					education: education,
					express: express,
					tel: tel,
					currentid: currentid,
					worktypeid: worktype,
					jobcateid: jobcateid,
					avatarUrl: logoimglist[0],
					tid: tid,
					money: money,
					jobpriceid: jobpriceid,
					status: status
				};
				note.Savenote((data) => {
					uni.navigateTo({
						url: '/pages/nextedu/index'
					});
				}, params);
			},

			deleteImg1: function(e) {
				var that = this;
				var index = e.currentTarget.dataset.index;
				that.logoimglist = [];
				that.setData({
					imgs1: [],
					show1: 'none'
				});
				console.log(index);
			},

			radioChange: function(e) {
				this.gender = e.detail.value;
			},

			radioHiddenChange: function(e) {
				this.ishidden = e.detail.value;
			},

			bindAreaChange: function(e) {
				var arealist = this.arealist;
				if (arealist) {
					this.areaid = arealist[e.detail.value].id;
					this.areaindexid = e.detail.value;
				}
				this.setData({
					arealist: arealist,
					areaindexid: e.detail.value
				});
			},

			bindJobcateChange: function(e) {
				var jobcate = this.jobcate;
				if (jobcate) {
					this.jobcateindex = e.detail.value;
					this.jobcateid = jobcate[e.detail.value].id;
				}
				this.setData({
					jobcate: jobcate,
					jobcateindex: e.detail.value
				});
			},

			bindCurrentChange: function(e) {
				var currentstatus = this.currentstatus;
				if (currentstatus) {
					this.currentstatusindex = e.detail.value;
					this.currentid = currentstatus[e.detail.value].id;
				}
				this.setData({
					currentstatus: currentstatus,
					currentstatusindex: e.detail.value
				});
			},

			bindExpressChange: function(e) {
				var express = this.express;
				if (express) {
					this.expressindex = e.detail.value;
					this.expressname = express[e.detail.value];
				}
				console.log(this.expressname);
				this.setData({
					express: express,
					expressindex: e.detail.value
				});
			},

			bindBirthdayChange: function(e) {
				var birthday = this.birthday;
				if (birthday) {
					this.birthdayindex = e.detail.value;
					this.birthdayname = birthday[e.detail.value];
				}
				this.setData({
					birthday: birthday,
					birthdayindex: e.detail.value
				});
			},

			bindEducationChange: function(e) {
				var education = this.education;
				if (education) {
					this.educationindex = e.detail.value;
					this.educationname = education[e.detail.value];
				}
				console.log(this.educationname);
				this.setData({
					education: education,
					educationindex: e.detail.value
				});
			},

			bindWorktypeChange2: function(e) {
				var worktype = this.worktype;
				if (worktype) {
					this.worktypeindex = e.detail.value;
					this.worktypename = worktype[e.detail.value];
				}
				console.log(this.worktypename);
				this.setData({
					worktype: worktype,
					worktypeindex: e.detail.value
				});
			},

			bindWorktypeChange: function(e) {
				var worktypelist = this.worktypelist;
				if (worktypelist) {
					this.worktypeid = worktypelist[e.detail.value].id;
					this.worktypeindexid = e.detail.value;
				}
				this.setData({
					worktypelist: worktypelist,
					worktypeindexid: e.detail.value
				});
			},

			bindMoneyChange: function(e) {
				var money = this.money;
				if (money) {
					this.moneyindex = e.detail.value;
					this.moneyname = money[e.detail.value];
				}
				console.log(this.moneyname);
				this.setData({
					money: money,
					moneyindex: e.detail.value
				});
			},

			bindCurrentstatusChange: function(e) {
				var currentstatus = this.currentstatus;
				if (currentstatus) {
					this.currentstatusindex = e.detail.value;
					this.currentstatusname = currentstatus[e.detail.value];
				}
				console.log(this.currentstatusname);
				this.setData({
					currentstatus: currentstatus,
					currentstatusindex: e.detail.value
				});
			},

			chooseImg: function(e) {
				var that = this;
				var count = 9;
				var id = parseInt(e.currentTarget.dataset.id);
				if (id == 1) {
					count = 1;
				}
				uni.chooseImage({
					count: count,
					// 默认9
					sizeType: ['compressed'],
					// 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'],
					// 可以指定来源是相册还是相机，默认二者都有
					success: function(res) {
						// 返回选定照片的本地文件路径列表，tempFilePath可以作为img标签的src属性显示图片

						var tempFilePaths = res.tempFilePaths;
						var imgs = [];
						if (id == 1) {
							that.logoimglist = [];
							that.setData({
								imgs1: tempFilePaths,
								show1: 'block'
							});
						} else if (id == 2) {
							that.imagelist = [];
							that.imgs2 = tempFilePaths;
							that.setData({
								imgs2: tempFilePaths,
								show2: 'block'
							});
						}

						// var tempFilePaths = that.data.imgs

						for (var s = 0; s < tempFilePaths.length; s++) {
							console.log(tempFilePaths[s]);
							that.uploadimg(tempFilePaths[s], id);
						}
					},
					fail: function(res) {},
					complete: function(res) {}
				});
			},

			uploadimg: function(path, id) {
				//var uploadurl = app.util.geturl({ 'url': 'entry/wxapp/upload' });
				// var id = id;
				uni.showToast({
					icon: 'loading',
					title: '正在上传'
				});
				var that = this;
				var params = {
					path: path
				};
				note.uploadimg((data) => {
					console.log(data);
					if (id == 1) {
						console.log(data.imgpath);
						that.logoimglist.push(data.imgpath);
						console.log(that.logoimglist);
					} else if (id == 2) {
						that.imagelist.push(data.imgpath);
					}
				}, params);
			},

			previewImg1() {
				console.log('占位：函数 previewImg1 未声明');
			}
		}
	};

	function isHasElementOne(arr, value) {
		for (var i = 0, vlen = arr.length; i < vlen; i++) {
			if (arr[i] == value) {
				return i;
			}
		}
		return -1;
	}

	function isHasElementTwo(arr, value) {
		for (var i = 0, vlen = arr.length; i < vlen; i++) {
			if (arr[i]['id'] == value) {
				return i;
			}
		}
		return -1;
	}
</script>
<style>
	.container {
		background-color: #f5f5f5;
		min-height: 100%;
		margin-bottom: 20%;
	}

	.container .main {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.container .main .header {
		width: 730rpx;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
		font-size: 0.9rem;
		padding-left: 20rpx;
		color: #000;
		text-align: center;
		background: #fff;
	}

	.container .main .title {
		width: 730rpx;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
		font-size: 0.9rem;
		padding-left: 20rpx;
		color: #888888;
	}

	.container .main .list {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		background: #fff;
	}

	::-webkit-input-placeholder {
		color: #000;
		font-size: 18px;
	}

	.container .main .list .item {
		width: 700rpx;
		border-bottom: 1rpx solid #f5f5f5;
		align-self: center;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		display: flex;
		flex-direction: column;
		/*
flex-direction: row;
justify-content:space-between;
*/
	}

	.container .main .list .item .name {
		font-size: 14px;
		color: #a2a2a2;
	}

	.container .main .list .item .name text {
		color: red;
	}

	.container .main .list .item .selectitem {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		color: #808080;
		font-size: 14px;
		height: 100rpx;
		line-height: 100rpx;
		background: #fff;
	}

	.container .main .list .item .selectitem input {
		height: 100rpx;
		width: 740rpx;
		color: #000;
		font-size: 18px;
	}

	.container .main .list .item .selectitem>image {
		width: 30rpx;
		height: 30rpx;
		align-self: center;
	}

	.container .main .checklist {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		width: 100%;
		background: #fff;
		flex-wrap: wrap;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		padding-left: 20rpx;
	}

	.radio {
		font-size: 18px;
		margin-right: 20rpx;
	}

	.picker {
		font-size: 18px;
	}

	.container .main .checklist checkbox-group {
		width: 720rpx;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
	}

	.container .main .checklist .checkitem {
		font-size: 0.7rem;
		width: 240rpx;
		margin-top: 10rpx;
	}

	.container .doagree {
		font-size: 0.7rem;
		margin-left: 50rpx;
		margin-top: 40rpx;
		margin-bottom: 280rpx;
		padding-bottom: 50rpx;
	}

	.container .main .imglist {
		width: 720rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		flex-wrap: wrap;
		background: #fff;
	}

	.container .main .imglist .imgitem {
		width: 200rpx;
		border: 1rpx dotted #f5f5f5;
		position: relative;
	}

	.container .main .imglist .imgitem image {
		width: 200rpx;
		height: 200rpx;
	}

	.sum {
		position: absolute;
		width: 45rpx;
		height: 45rpx;
		border-radius: 50%;
		background: #3274e5;
		top: -10rpx;
		left: 150rpx;
		color: #fff;
		z-index: 1000;
		font-size: 0.7rem;
		display: flex;
		flex-direction: row;
		justify-content: center;
	}

	.sum text {
		font-size: 0.7rem;
		align-self: center;
	}

	.weixinmao-msg {
		position: absolute;
		top: 0%;
		left: 0%;
		width: 100%;
		height: 100%;
		background-color: black;
		z-index: 2001;
		background: rgba(0, 0, 0, 0.7);
		display: flex;
		flex-direction: row;
		justify-content: center;
	}

	.weixinmao-content {
		width: 720rpx;
		height: 450rpx;
		z-index: 4001;
		background: #fff;
		align-self: center;
		border-radius: 8rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.map {
		height: 850rpx;
	}

	.mapbtn {
		background: #3274e5;
		color: #fff;
		font-size: 1rem;
		width: 400rpx;
	}

	.weixinmao-content .title {
		border-bottom: 1rpx solid #e5e5e5;
		width: 100%;
		text-align: center;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		font-size: 0.8rem;
		background: #3274e5;
		color: #fff;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}

	.weixinmao-content .title view:nth-child(1) {
		width: 30%;
	}

	.weixinmao-content .title view:nth-child(2) {
		width: 40%;
	}

	.weixinmao-content .title view:nth-child(3) {
		width: 30%;
	}

	.weixinmao-content .list {
		display: flex;
		flex-direction: column;
		width: 100%;
		align-items: center;
	}

	.weixinmao-content .list .item {
		width: 100%;
		align-self: center;
		text-align: center;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
		border-bottom: 1rpx solid #f5f5f5;
	}

	.weixinmao-foot {
		display: flex;
		justify-content: center;
		flex-direction: row;

		z-index: 999;

		width: 100%;
	}

	.weixinmao-foot view {
		color: #fff;
		align-self: center;
		height: 100rpx;
		line-height: 100rpx;
		font-size: 0.9rem;
		display: flex;
		flex-direction: row;
		width: 50%;
		border-radius: 0rpx;
		padding-left: 30rpx;
		background: #e64340;
	}

	.ismaster {
		color: red;
		font-weight: bold;
		padding-left: 20rpx;
		padding-right: 20rpx;
		padding-top: 30rpx;
		align-self: center;
	}

	.selectitem textarea {
		width: 100%;
	}

	.heaerpic {
		width: 380rpx;
		height: 250rpx;
		align-self: center;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.heaerpic image {
		width: 160rpx;
		height: 160rpx;
		border: 7rpx solid #fff;
		border-radius: 160rpx;
	}

	.heaerpic view {
		height: 80rpx;
		line-height: 80rpx;
		width: 380rpx;
		text-align: center;
		font-size: 0.8rem;
	}

	.ql-container {
		box-sizing: border-box;
		width: 100%;
		height: 100%;
		font-size: 16px;
		line-height: 1.5;
		overflow: auto;
		padding: 10px 10px 20px 10px;
		border: 1px solid #ececec;
	}

	.ql-active {
		color: #22c704;
	}

	.iconfont {
		display: inline-block;
		width: 30px;
		height: 30px;
		cursor: pointer;
		font-size: 20px;
	}

	.toolbar {
		box-sizing: border-box;
		padding: 0 10px;
		height: 50px;
		width: 100%;
		position: fixed;
		left: 0;
		right: 100%;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border: 1px solid #ececec;
		border-left: none;
		border-right: none;
	}

	.footer {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		z-index: 99;
	}

	.uploadlist {
		display: flex;
		width: 100%;
		flex-direction: column;
		align-items: center;
		margin-bottom: 50rpx;

		background: #fff;
	}

	.uploadlist .title {
		width: 700rpx;
		color: #141c31;
		font-weight: bold;
		font-size: 1.1rem;
		align-self: left;
	}

	.uploadlist .item {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		flex-wrap: wrap;
		margin-top: 20rpx;
		width: 650rpx;
	}

	.uploadlist .title view:nth-child(2) {
		color: #808080;
		font-size: 0.7rem;
		font-weight: 300;
		margin-top: 10rpx;
	}

	.uploadlist .item .uploadimg {
		width: 300rpx;
		height: 300rpx;
		border-radius: 5rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.uploadlist .item .uploadimg image {
		width: 120rpx;
		height: 120rpx;
	}

	.uploadlist .item .uploadimg .uploadtitle {
		color: #808080;
		font-size: 0.7rem;
	}

	.imgsbox {
		width: 690rpx;
		padding: 20rpx;
		margin: auto;
		background: #fff;
		border-radius: 0 0 14rpx 14rpx;
		border: 1px solid #d6d7dc;

		box-sizing: border-box;
		overflow: hidden;
	}

	.weui-cells {
		font-size: 30rpx !important;
	}

	.weui-cell::before {
		border-top: 1rpx solid #eee;
	}

	.upload-img-btn image {
		width: 185rpx;
		height: 185rpx;
	}

	.upload-img-btn {
		float: left;
	}

	.img {
		width: 185rpx;
		height: 185rpx;
		float: left;
		margin: 15rpx;
		position: relative;
		overflow: hidden;
	}

	.delete-btn {
		position: absolute;
		bottom: 0;
		left: 0;
		background-color: rgba(0, 0, 0, 0.5);
		color: #fff;
		text-align: center;
		line-height: 40rpx;
		width: 100%;
	}

	.img image {
		width: 185rpx;
		height: 185rpx;
	}

	.imgx {
		width: 15rpx;
		height: 15rpx;
	}

	.weui-select {
		border-right: none;
	}

	.weui-uploader__hd {
		float: left;
	}

	.weui-uploader__title {
		width: 150rpx !important;
	}

	.weui-label {
		width: 150rpx !important;
	}

	.upload-img-btn image {
		margin: 10rpx;
	}

	.weixinmao-float {
		height: 150rpx;
	}

	.weixinmao-foot {
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		z-index: 999;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 150rpx;
		background: #fff;
		padding-top: 10rpx;
		padding-bottom: 30rpx;
	}

	button::after {
		border: none;
	}

	.weixinmao-foot button {
		color: #fff;
		align-self: center;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		font-size: 0.9rem;
		display: flex;
		flex-direction: column;
		background: #fe552e;
		width: 100%;
		border-radius: 5rpx;
	}

	.weixinmao-foot view image {
		width: 50rpx;
		height: 50rpx;
		align-self: center;
	}

	.footerbutton {
		background: #fe552e;
	}
</style>